//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

namespace Microsoft.Research.ScientificWorkflow.TridentModelSL
{
    using System.Collections.ObjectModel;
    using service = Microsoft.Research.ScientificWorkflow.TridentSilverlightService;

    /// <summary>
    /// 
    /// </summary>
    public class DetailedWorkflowModel : BaseModel
    {
        /// <summary>
        /// Gets or sets the workflow required parameters.
        /// </summary>
        /// <value>The workflow required parameters.</value>
        public Collection<ParameterDescriptionModel> WorkflowRequiredParameters
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the nodes.
        /// </summary>
        /// <value>The nodes.</value>
        public Collection<NodeModel> Nodes
        {
            get;
            set;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="DetailedWorkflowModel"/> class.
        /// </summary>
        /// <param name="wfModel">The wf model.</param>
        public DetailedWorkflowModel(service.DetailedWorkflowModel workflowModel)
        {
            base.Name = workflowModel.name;
            base.Label = workflowModel.label;
            base.Id = workflowModel.id;
            this.WorkflowRequiredParameters = new Collection<ParameterDescriptionModel>();
            workflowModel.workflowRequiredParameters.ForEach(param =>
                this.WorkflowRequiredParameters.Add(new ParameterDescriptionModel(param)));
            this.Nodes = new Collection<NodeModel>();
            workflowModel.nodes.ForEach(node =>
                this.Nodes.Add(new NodeModel(node)));
        }
    }
}
